package com.yanqu.road.entity.activity.wishpool;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.DataStatus;

import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_u_wish_pool")
public class WishPoolUserData extends DataObject {

    @FieldTypeAnnotation(desc = "用户ID", select = true)
    private long userId;

    @FieldTypeAnnotation(desc = "活动ID", select = true)
    private int activityId;

    @FieldTypeAnnotation(desc = "许愿值", update = true)
    private int wishValue;

    @FieldTypeAnnotation(desc = "重置时间", update = true)
    private long resetTime;

    @FieldTypeAnnotation(desc = "今日许愿次数", update = true)
    private int wishTimes;

    /**
     * 许愿池设置的奖励，DB存JSON
     */
    private List<WishPoolUserReward> wishRewardList = new ArrayList<>();

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public void setWishValue(int wishValue) {
        if (this.wishValue != wishValue) {
            this.wishValue = wishValue;
            setOp(DataStatus.Update);
        }
    }

    public void setResetTime(long resetTime) {
        if (this.resetTime != resetTime) {
            this.resetTime = resetTime;
            setOp(DataStatus.Update);
        }
    }

    public void setWishTimes(int wishTimes) {
        if (this.wishTimes != wishTimes) {
            this.wishTimes = wishTimes;
            setOp(DataStatus.Update);
        }
    }

    public long getUserId() {
        return userId;
    }

    public int getWishValue() {
        return wishValue;
    }

    public long getResetTime() {
        return resetTime;
    }

    public int getWishTimes() {
        return wishTimes;
    }

    public List<WishPoolUserReward> getWishRewardList() {
        return wishRewardList;
    }

    public void setWishRewardList(List<WishPoolUserReward> wishRewardList) {
        this.wishRewardList = wishRewardList;
        setOp(DataStatus.Update);
    }

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

}